/**
 * Created by kangdaye on 16/6/5.
 */
app.controller('plainVipDetailCtr',["$scope","ngDialog","$stateParams","plainVipCache","plainVipService", function($scope,ngDialog,$stateParams,plainVipCache,plainVipService) {
    $scope.detailData = {};
    $scope.listData = {};
    $scope.getData = angular.extend({
        pageNo : 1,
        pageSize : 10
    },$stateParams);

    $scope.getListDataFn = function(){
        plainVipService.ordersList($scope.getData,function(data){
            $scope.listData = data.data;
        });
    };

    plainVipService.detail($stateParams,function(data){
        $scope.detailData = data.data;
    });

    $scope.getListDataFn();

    $scope.changeBalance = function(id,nickname){
        ngDialog.closeAll();
        ngDialog.open({
            template: '/admin/view/vip/distrVip/distrVipChangeBalanceDialog.html',
            width: 400,
            controller: 'distrVipChangeBalanceDialogCtr',
            resolve: {
                getData: function() {
                    return {
                        id : id,
                        nickname:nickname
                    };
                }
            }
        });
    };
}]);
